package cn.zktr.Personnel.controllers.zhouxiong;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.zktr.Personnel.model.service.zhouxiong.KaoQinKaService;
import cn.zktr.Personnel.model.service.zhouxiong.QiTaYeWuService;

@Controller
public class YuanGongKaoQinJiLuController {
	
	@Autowired
	private KaoQinKaService kqk;
	@Autowired
	private QiTaYeWuService yw;

	@RequestMapping("zx/yuan-gong-kao-qin")
	public void zhujiemian() {}
	
	@RequestMapping("YuanGongKaoQinJiLu")
	@ResponseBody
	public Map<String,Object> kaoqin(Integer empid,String date,int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",kqk.seleYuanGongKaoQin(empid).size());
		Page<Object> p=PageHelper.startPage(page,rows);
		List<JSONObject> dates = kqk.seleYuanGongKaoQin(empid);
		map.put("rows",dates);
		return map;
	}
	

	@RequestMapping("zx/yuan-gong-qin-jia")
	public void qinjia() {}
	
	/**根据员工id查询请假
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("YuanGongQinJia")
	@ResponseBody
	public Map<String,Object> qinjialiebiaos(Integer empid,int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		//页内容
		map.put("total",yw.seleQinJiaEmp(empid).size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=yw.seleQinJiaEmp(empid);
		map.put("rows",findAll);
		return map;
	}

}
